<?php
include '../class/general.php';
include '../class/eat.php';
include '../class/sleep.php';
$step = isset($_GET['step']) ? $_GET['step'] : 1;

$general = new General();

$general->attack();
echo '<hr>';

if ($step>1){
	$sleepDecorator = new SleepDecorator($general);
	$sleepDecorator->attack();
	$sleepDecorator->sleep();
	echo '<hr/>';
}

if ($step>2){
	$eatDecorator = new EatDecorator($sleepDecorator);
	$eatDecorator->attack();
	$eatDecorator->sleep();
	$eatDecorator->eat();
	echo '<hr/>';
}

if ($step>3){
	$general = new EatDecorator( new SleepDecorator( new General() ) );
	$general->attack();
	$general->sleep();
	$general->eat();
}